{extend name="../../admin/view/main"}

{block name='content'}
<form action="{:request()->url()}" autocomplete="off" class="layui-form layui-card" data-auto="true" method="post">
    <div class="layui-card-body padding-40">

        <label class="layui-form-item relative block">
            <span class="color-green font-w7">名称</span>
            <span class="color-desc margin-left-5">Banner Title</span>
            <input class="layui-input" name="title" placeholder="请输入名称" required value='{$data.title|default=""}'>
        </label>
        <div class="layui-form-item relative block">
            <span class="color-green font-w7">展示位置</span>
            <span class="color-desc margin-left-5">Type</span>
            <select class="layui-select" lay-search name="type">
                <option value="">--- 资讯类型 ---</option>
                {foreach $news_type as $k => $t}
                {eq name='$data.type|default="0"' value='$k'}
                <option selected value="{$k}">{$t|default=''}</option>
                {else}
                <option value="{$k}">{$t|default=''}</option>
                {/eq}
                {/foreach}
            </select>
        </div>
        <div class="layui-form-item relative block">
            <span class="color-green font-w7">封面图</span>
            <span class="color-desc margin-left-5">Image</span>
            <br>
            <input type="hidden" name="image" value="{$data.image|default=''}">
            <script>$('[name=image]').uploadOneImage()</script>
            <br>
        </div>
        <div class="layui-form-item relative block">
            <span class="color-green font-w7 label-required-prev">内容</span>
            <span class="color-desc margin-left-5">Page Content</span>
            <label class="relative block">
                <textarea class="layui-hide" name="content">{$data.content|default=''}</textarea>
            </label>
        </div>

        <div class="hr-line-dashed"></div>

        <div class="layui-form-item text-center">
            <button class="layui-btn" type="submit">保存数据</button>
            <button class="layui-btn layui-btn-danger" data-confirm="确定要取消编辑吗？" data-history-back type='button'>取消编辑</button>
        </div>
    </div>

</form>

<script>
    layui.form.render();
    require(['ckeditor'], function () {
        window.createEditor('[name=content]', {height: 500});
    });
</script>
{/block}